<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>中国福利彩票</title>
<link href="css/style.css" type="text/css" rel="stylesheet" />
	<link rel="icon" href="images/favicon.png" type="image/x-icon"/>
<script src="js/jquery-1.7.2.min.js"></script>

<!--日期插件-->
<script type="text/javascript" src="js/hDate.js"></script>
<link href="css/hDate.css" rel="stylesheet" />

</head>

<body>
	<div class="Header">
    	<div class="width1200">
        	<div class="left H_logo"><a href="MemberCenter.html"><img src="images/logo.png" width="200" /></a></div>
            <div class="right H_right">欢迎  <a href="MemberCenter.html"><span id="userName"></span></a> <a href="Login.html">注销！</a></div>
            <div class="clear"></div>
        </div>
    </div>
	
    <div class="width1200">
    	<div class="I_main">
            <div class="left IM_left">
            	<div class="IM_T1">查询服务</div>
                <div class="IML_two">
                	<ul>
						<li class="fist"><a href="Xzhtz.html" style="border:none;" ><img src="images/Limg1.png" width="16" />交易记录查询</a></li>
						<li><a href="Xzjls.html"><img src="images/Limg1.png" width="16" />资金记录查询</a></li>
                    </ul>
                </div>
                <div class="IM_T2">个人设置</div>
                <div class="IML_two">
                	<ul>
                    	<li><a href="BankCard.html"><img src="images/Limg2.png" width="16" />银行卡变更</a></li>
                        <li><a href="PhoneNumber.html"><img src="images/Limg3.png" width="16" />手机号变更</a></li>
                        <li><a href="Yuecx.html"><img src="images/Limg4.png" width="16" />余额查询</a></li>
                        <li><a href="PassWord.html"><img src="images/Limg5.png" width="16" />修改密码</a></li>
                        <li><a href="App.html"><img src="images/Limg6.png" width="16" />APP下载</a></li>
                    </ul>
                </div>
            </div>
            <div class="right IM_right">
            	
                <div class="IMR_title">
                	<img src="images/RTb.jpg" width="5" />交易记录查询
                	<input type="text" id="curPage" value="0" style="display: none;"/>
                </div>
                
                <div class="IM_Rbig">
                	
                    <div class="N_XL">
                    	<table width="100%" border="0" cellspacing="0" cellpadding="0" id="resultTable">
                          <tr>
                          </tr>
                        </table>
                        <a href="#" onclick="query(0)"><span id="lastPage">上一页</span></a>
                        <a href="#" onclick="query(1)"><span id="nextPage">下一页</span></a>
                  </div>
                    
              </div>
                
            </div>
            <div class="clear"></div>
    	</div>
    </div>
    
    <div class="Footer">
    	<div class="width1200">
        	<div class="left">版权所有：中国福利彩票发行管理中心    网站主办：中国福利彩票发行管理中心</div>
            <div class="right"><img src="images/Flogo.png" width="110" /></div>
            <div class="clear"></div>
        </div>
    </div>
</body>
<script type="text/javascript">
var accountId="";
var game = "";
var startTimeStamp="";
var endTimeStamp ="";
jQuery(document).ready(function($){
	$('#userName').html(getCookie("username"));
	accountId = getCookie("accountId");
	game = GetQueryString("game");
	startTimeStamp = GetQueryString("startTime");
	endTimeStamp = GetQueryString("endTime");
	query(null);
});

function query(pagetype){
	var previousOrderNo="";
	if(pagetype==0){
		previousOrderNo = $('#resultTable tr:eq(1) td:eq(0)').html();
	}else if(pagetype==1){
		previousOrderNo = $("#resultTable tr:last td:eq(0)").html();
	}
 var para = {
	  	accountId:accountId,
	  	gameCode:game,
		startTime:startTimeStamp,
		endTime:endTimeStamp,
		pagetype:pagetype,
		previousOrderNo:previousOrderNo,
		pageSize:$('#curPage').val()
};
	$.ajax({
		url : "/api/CrmSystem/searchWagerInfo",
		async:false,
		type : "POST",
		herder:{
			'Accept':'application/json',
			'Content-Type':'application/json'
		},
		dataType:"json",
		contentType:"application/json",
		data: JSON.stringify(para),
		error:function(XMLHttpRequest, textStatus, errorThrown){
			alert(errorThrown);
		},
		success: function(data, textStatus){
			if(data.success == true){
				$('#curPage').val(data.currentPageSize);
				if(!data.hasNextPage){
					$('#nextPage').hide();
				}else{
					$('#nextPage').show();
				}
				if($('#curPage').val()=='0'){
					$('#lastPage').hide();
				}else{
					$('#lastPage').show();
				}
// 				var data="{\"decription\":\"success\",\"retCode\":0,\"retObj\":[{\"orderNo\":\"a23456789fghj56789\",\"acceptTime\":1399977068000,\"gameCode\":\"slot1\",\"periodNum\":\"20160101\",\"wagerAmount\":2000,\"awardAmount\":2100000,\"infaceAwardAmount\":16000,\"wagerStatus\":1,\"prizeType\":4,\"cashed\":1,\"wagerDes\":\"投注成功\"},{\"orderNo\":\"a23456789fghj56789\",\"acceptTime\":1399977068000,\"gameCode\":\"slot2\",\"periodNum\":\"20160101\",\"wagerAmount\":2000,\"awardAmount\":2100000,\"infaceAwardAmount\":16000,\"wagerStatus\":1,\"prizeType\":4,\"cashed\":1,\"wagerDes\":\"投注成功\"},{\"orderNo\":\"a23456789fghj56789\",\"acceptTime\":1399977068000,\"gameCode\":\"slot3\",\"periodNum\":\"20160101\",\"wagerAmount\":2000,\"awardAmount\":2100000,\"infaceAwardAmount\":16000,\"wagerStatus\":1,\"prizeType\":4,\"cashed\":1,\"wagerDes\":\"投注成功\"}],\"success\":true}";
// 				 data = eval("("+data+")"); 
	// 			 //清空table数据再加载
				 $("#resultTable tbody").empty();
				 $("#resultTable tbody").append('<tr align="center"><td style="display: none;">orderNo</td><td width="20%" height="34" align="center" bgcolor="#ededed" class="bold">投注时间</td><td width="16%" height="34" align="center" bgcolor="#ededed" class="bold">投注游戏</td> <td width="16%" height="34" align="center" bgcolor="#ededed" class="bold">投注金额(元)</td><td width="16%" height="34" align="center" bgcolor="#ededed" class="bold">票投注状态</td><td width="16%" height="34" align="center" bgcolor="#ededed" class="bold">中奖情况</td><td width="16%" height="34" align="center" bgcolor="#ededed" class="bold">详情</td></tr>');
				for(var i=0;i<data.retObj.length;i++){
					if(data.retObj[i].awardAmount == 0){
						$("#resultTable tbody").append('<tr align="center">' +
						'<td>'+getLocalTime(data.retObj[i].acceptTime,'yyyy-MM-dd HH:mm:ss')+'</td>' +
							/*'<td>'+data.retObj[i].gameCode+'</td>' +*/
						'<td>双色球</td>' +
						'<td>'+data.retObj[i].wagerAmount/100+'</td>' +
						'<td>'+converName[data.retObj[i].wagerStatus]+'</td>' +
						'<td>'+code2WinName[data.retObj[i].prizeType]+'</td>' +
						'<td style="display: none;">'+data.retObj[i].orderNo+'</td>' +
						'<td><a href="#" onclick="getDetail(\''+data.retObj[i].orderNo+'\',\''+data.retObj[i].periodNum+'\')">查看</a></td>' +
						'</tr>');
					}else{
						$("#resultTable tbody").append('<tr align="center">' +
						'<td>'+getLocalTime(data.retObj[i].acceptTime,'yyyy-MM-dd HH:mm:ss')+'</td>' +
							/*'<td>'+data.retObj[i].gameCode+'</td>' +*/
						'<td>双色球</td>' +
						'<td>'+data.retObj[i].wagerAmount/100+'</td>' +
						'<td>'+converName[data.retObj[i].wagerStatus]+'</td>' +
						'<td>'+data.retObj[i].awardAmount/100+'</td>' +
						'<td style="display: none;">'+data.retObj[i].orderNo+'</td>' +
						'<td><a href="#" onclick="getDetail(\''+data.retObj[i].orderNo+'\',\''+data.retObj[i].periodNum+'\')">查看</a></td>' +
						'</tr>');
					}

				}
			}else{
				window.location.assign(encodeURI('XzhtzDown.html?description='+data.description+''));
				return;
			}
		}		
	});
}

var code2WinName = {
	"0": "未中奖",
	"1": "未开奖",
	"2": "未刮开",
	"3": "小奖",
	"4": "大奖",
	"44": ""
}

var converName = {
	"0": "投注成功",
	"1": "投注失败",
	"2": "投注中",
	"3": "待投注"
}

//点击查看按钮查看详情
function getDetail(orderNo,periodNum){
	window.location.href='XzhtzDetailed.html?orderNo='+orderNo+'&accountId='+accountId+'&periodNum='+periodNum+'';
}
</script>
<script src="js/common.js"></script>
<script src="js/jsCallCookies.js"></script>
</html>
